<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>CSS Animations Test: animation-delay - 0s</title>
<style>
  div {
    animation-name: sample;
    animation-duration: 3s;
    animation-delay: 0s;

    background-color: blue;
    height: 100px;
    width: 100px;
    position: relative;
  }

  @keyframes sample {
    from {
      left: 150px;
    }
    to {
      left: 0px;
    }
  }
</style>
</head>
<body>
  <p>
    Test passes if there is a filled blue square with 'Filler Text',
    which starts moving from right to left as soon as the page loads.
  </p>
  <div id="animation-box">Filler Text</div>
</body>
<script>
  await sleep(0.2);
  let animationBox = document.getElementById('animation-box');
  expect(animationBox.offsetLeft < 150 && animationBox.offsetLeft > 120).toBe(true, `animation start should be on the right: ${animationBox.offsetLeft}`);
  await sleep(1);
  expect(animationBox.offsetLeft > 35 && animationBox.offsetLeft < 75).toBe(true, `animation should be in the middle: ${animationBox.offsetLeft}`);
  await sleep(3);
  expect(animationBox.offsetLeft === 0).toBe(true, `animation should be ended: ${animationBox.offsetLeft}`);
</script>
